package com.ft.service;

import com.ft.mapper.OrderMapper;
import com.ft.model.Order;
import com.ft.model.enums.OrderStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author: zhangjianghua
 * @Date: 2018-10-10 10:53
 */
@Service
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;

    public void save(Order order){
        order.setId(213L);
        order.setStatus(OrderStatusEnum.WAIT_FOR_PAYMENT);
        order.setAmount(new BigDecimal(12));
        orderMapper.insert(order);
    }

    public void update(Order order){
        orderMapper.updateByPrimaryKeySelective(order);
    }

    public Order findOne(Long id){
        return orderMapper.selectByPrimaryKey(id);
    }
}
